<extend name="Public/base"/>
<block name="style">
    <link rel="stylesheet" href="http://cache.amap.com/lbs/static/main1119.css"/>
    <link rel="stylesheet" href="__STATIC__/styles/vendors/bootstrap-table.css">
    <link rel="stylesheet" href="__STATIC__/styles/layout.css">

    <link rel="stylesheet" href="__STATIC__/styles/vendors/bootstrap-select.min.css">
    <link rel="stylesheet" href="__STATIC__/styles/vendors/bootstrap-toggle.min.css">
    <link rel="stylesheet" href="__STATIC__/styles/map_manage.css">
    <style>
        .dot-list{
            text-align: center;
        }
        .dot-list button{
            /*background: url("__STATIC__/images/havens.png");*/
            margin: auto;
        }
    #searchbox-content {
        position: absolute;
        top: 10px;
        right: 210px;
    }
    #tipinput{
        height: 40px;
        border: 1px solid #f4f4f4;
        border-bottom: 1px solid #ccc;
    }
    #searchbox-content .input-clear {
        cursor: pointer;
        position: absolute;
        width: 27px;
        height: 38px;
        top:1px;
        right: 10px;
        background: url(__STATIC__/images/close_s.png) no-repeat 0 -114px #fff;
        display: none;
    }
    #panel {
    position: absolute;
    background-color: white;
    max-height: 90%;
    overflow-y: auto;
    top: 52.5px;
    right: 108px;
    z-index: 1;
    width: 280px;
}
    </style>
</block>
<block name="content">
    <div class="fixed-table-toolbar" id="tool-bar">
        <div class="bs-bars pull-left">
            <div id="toolbar">
                <button id="clear" class="btn btn-danger btn-flat">清除标注</button>
                <button type="button" value="绘制点" class="draw btn btn-primary" id="point"/>绘制点</button>
                <button type="button" value="绘制线" class="draw btn btn-primary" id="line"/>绘制线</button>
                <button type="button" value="绘制面" class="draw btn btn-primary" id="polygon"/>绘制面</button>
                <button type="button" value="绘制文本" class="draw btn btn-primary" id="drawtext"/>绘制文本</button>
                <button style="display: none;" type="button" value="绘制园" class="draw btn btn-primary" id="circle"/>绘制圆</button>
            </div>
        </div>

        <div class="pull-right search">
            <div id="search-select">
                <select id="mapSelect" class="selectpicker">
                    <option value="0">所有</option>
                    <volist name=":C('MAP_BUTTON')" key="k" id="item">
                        <option value="{$k}">{$item.title}</option>
                    </volist>
                </select>
            </div>
            <input class="form-control" id="search" type="text" placeholder="搜索">
            <button class="btn btn-primary searchButton">搜索</button>
        </div>
        <div class="float-clear"></div>
    </div>

    <div style="position: relative;border: 1px solid #ddd; border-top: 0">
        <div id="map"></div>

<div id="searchbox-content">
    <input id="tipinput" class="form-control" placeholder="查找地点"/>
    <div class="input-clear" title="清空"></div>  
</div>
<div id="panel"></div>
        <div id="dot-lists">
            <ol>
                <volist name=":C('MAP_BUTTON')" id="item">
                    <li class="dot-list">
                        <input type="checkbox" class="toggleButton" data-url="{$item.url|U}" data-class-id="{$item.class_id}" data-class="{$item.class}" data-original-title="{$item.title}" >
                    </li>
                </volist>
            </ol>
        </div>
    </div>

    <div class="modal fade" id="datum_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="container-fluid">
                    <div class="modal-header">
                        
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                        <h4 class="modal-title" id="title_name" style="text-align:center;">title</h4>
                    </div>
                    <div class="modal-body">
                        <table id="datum_table" class="table table-condensed table-bordered">

                        </table>
                        <div class="control-group enclosureDiv">
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 left">
                                <label class="control-label" >附件:</label>
                            </div>
                        </div>
                        <div id="enclosureDiv" class="control-group row enclosureDiv">
                            <div class="col-lg-9 col-md-9 col-sm-9 col-xs-9 right">
                                <div class="controls">
                                    <ul id="enclosures">

                                    </ul>
                                </div>
                            </div>
                        </div>

                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default btn-flat" data-dismiss="modal">关闭</button>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="modal fade" id="complex_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-body row">
                    <div class="col-lg-4 col-md-4 col-sm-4 col-xs-4">
                        <div class="control-group">
                            <label class="control-label">坐标</label>
                            <div class="controls">
                                <input type="text" class="form-control" name="coordinate1">
                            </div>
                            <div class="controls" style="margin-top: 10px">
                                <input type="text" class="form-control" name="coordinate2">
                            </div>
                        </div>
                    </div>
                    <div class="col-lg-4 col-md-4 col-sm-4 col-xs-4">
                        <div class="control-group">
                            <label class="control-label" for="sort">种类</label>
                            <div class="controls">
                                <input type="text" class="form-control"
                                       id="sort" name="sort">
                            </div>
                        </div>
                        <div class="control-group" style="margin-top: 15px">
                            <label class="control-label" for="name">名称</label>
                            <div class="controls">
                                <input type="text" class="form-control"
                                       id="name" name="name">
                            </div>
                        </div>
                    </div>
                    <div class="col-lg-4 col-md-4 col-sm-4 col-xs-4">
                        <div class="control-group">
                            <label class="control-label" for="addition">备注</label>
                            <div class="controls">
                <textarea class="form-control" style="height: 108px"
                          id="addition" name="addition"></textarea>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-success btn-flat">确定</button>
                    <button type="button" class="btn btn-default btn-flat" data-dismiss="modal">取消</button>
                </div>
            </div>
        </div>
    </div>


    <div class="modal fade" id="terminal_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel2">
        <div class="modal-dialog " role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">在线终端</h4>
                </div>

                <div class="modal-body">

                    <div class="control-group row">
                        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 left">
                            <label class="control-label" for="real_name">姓名:</label>
                        </div>
                        <div class="col-lg-9 col-md-9 col-sm-9 col-xs-9 right">
                            <div class="controls">
                                <input type="text" class="form-control" readonly id="real_name" name="real_name">
                            </div>
                        </div>
                    </div>

                    <div class="control-group row">
                        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 left">
                            <label class="control-label" for="sex">性别:</label>
                        </div>
                        <div class="col-lg-9 col-md-9 col-sm-9 col-xs-9 right">
                            <div class="controls">
                                <select name="sex" id="sex" class="form-control" disabled>
                                    <option value="1" selected="selected">男</option>
                                    <option value="2">女</option>
                                </select>
                            </div>
                        </div>
                    </div>

                    <div class="control-group row">
                        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 left">
                            <label class="control-label" for="phone">电话:</label>
                        </div>
                        <div class="col-lg-9 col-md-9 col-sm-9 col-xs-9 right">
                            <div class="controls">
                                <input type="text" class="form-control" id="phone" name="phone" readonly>
                            </div>
                        </div>
                    </div>

                    <div class="control-group row">
                        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 left">
                            <label class="control-label" for="phone">身份证:</label>
                        </div>
                        <div class="col-lg-9 col-md-9 col-sm-9 col-xs-9 right">
                            <div class="controls">
                                <input type="text" class="form-control" id="IDCard" name="IDCard" readonly>
                            </div>
                        </div>
                    </div>

                    <div class="control-group row">
                        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 left">
                            <label class="control-label" for="position">职务:</label>
                        </div>
                        <div class="col-lg-9 col-md-9 col-sm-9 col-xs-9 right">
                            <div class="controls">
                                <input type="text" class="form-control" id="position" name="position" readonly>
                            </div>
                        </div>
                    </div>


                    <!--<div class="control-group row">-->
                        <!--<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 left">-->
                            <!--<label class="control-label" for="role_name">角色:</label>-->
                        <!--</div>-->
                        <!--<div class="col-lg-9 col-md-9 col-sm-9 col-xs-9 right">-->
                            <!--<div class="controls">-->
                                <!--<input type="text" class="form-control" id="role_name" name="role_name" readonly>-->
                            <!--</div>-->
                        <!--</div>-->
                    <!--</div>-->

                    <!--<div class="control-group row">-->
                        <!--<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 left">-->
                            <!--<label class="control-label" for="position">IMEI:</label>-->
                        <!--</div>-->
                        <!--<div class="col-lg-9 col-md-9 col-sm-9 col-xs-9 right">-->
                            <!--<div class="controls">-->
                                <!--<input type="text" class="form-control" id="IMEI" name="IMEI" readonly>-->
                            <!--</div>-->
                        <!--</div>-->
                    <!--</div>-->

                    <div class="control-group row">
                        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 left">
                            <label class="control-label" >头像:</label>
                        </div>
                        <div class="col-lg-9 col-md-9 col-sm-9 col-xs-9 right">
                            <div class="controls">
                                <div id="icon_div" class="col-sm-5" style="padding-left: 0px;">
                                    <input type="hidden" id="icon" name="icon" value="">
                                    <div class="image_show" style="display: none">
                                    </div>
                                </div>

                            </div>
                        </div>
                    </div>

                </div>
                <input type="hidden" name="mail_list_id" id="mail_list_id" value="">
                <div class="modal-footer">

                    <button type="button" class="btn btn-default btn-flat" data-dismiss="modal">关闭</button>
                </div>
            </div>

        </div>
    </div>
</block>

<block name="script">
    <script src="__STATIC__/scripts/vendors/bootstrap-select.min.js"></script>
    <script src="__STATIC__/scripts/vendors/bootstrap-toggle.min.js"></script>

    <script src="http://cache.amap.com/lbs/static/es5.min.js"></script>
    <script type="text/javascript" src="http://webapi.amap.com/maps?v=1.3&key={:C('AMAP_KEY2')}"></script>
    <!-- <script type="text/javascript" src="http://webapi.amap.com/maps?v=1.3&key={:C('AMAP_KEY')}"></script> -->
    <script>

        var $terminalModal = $('#terminal_modal');
        var $datumModal = $('#datum_modal');
        var $complexModal = $('#complex_modal');
        var $datumTable = $('#datum_table');

        var internal = 2000;

        var key = "{:C('AMAP_KEY')}";
        var test;
        var theMap;
        var mousetool, ruler,autocomplete, placeSearch;
        function initMap(){
            $.get(
                'http://restapi.amap.com/v3/ip?key=' + key,
                function (data) {
                    var center = getRectangleCenter(data.rectangle);
                    theMap = new AMap.Map('map', {
                        resizeEnable: true,
                        zoom:11,
                        center: center,
                    });
                    theMap.plugin(["AMap.ToolBar","AMap.MouseTool","AMap.RangingTool","AMap.Autocomplete","AMap.PlaceSearch"], function() {
                        theMap.addControl(new AMap.ToolBar());
                        mousetool = new AMap.MouseTool(theMap); 
                        // ruler = new AMap.RangingTool(theMap);
                        autocomplete= new AMap.Autocomplete({
                            city: data.city,
                            input: "tipinput", 
                         });
                        var placeSearch = new AMap.PlaceSearch({
                            map:theMap,
                            pageSize:1,
                            pageIndex:1,
                            city: data.adcode,
                            // panel: "panel",
                            citylimit: true,    

                         });
                         AMap.event.addListener(autocomplete, "select", function(e){
                           //TODO 针对选中的poi实现自己的功能
                           
                           placeSearch.setCity(data.adcode);
                           placeSearch.setPageIndex(1);
                           if (e.poi.adcode == "") {
                                placeSearch.setPageSize(10);
                                placeSearch.search(e.poi.name);
                           }else{
                                placeSearch.setPageSize(1);
                                placeSearch.setCity(e.poi.adcode);
                                placeSearch.search(e.poi.name,callbackPS);

                            }
                           
                         });
                        function callbackPS(){
                            $('.amap_lib_placeSearch_page').remove();
                        }
                        // AMap.event.addListener(autocomplete, "complete", function(e){   
                            
                        // });    
                        $('.input-clear').click(function(){
                            placeSearch.clear();
                            $('.amap-marker-content').remove();
                            $('#tipinput').val('');
                            $('.input-clear').css('display','none');
                        })
                        $('#tipinput').bind('input propertychange', function() { 
                            $('#panel').html('');
                            if ($(this).val().length > 0) {
                                $('.input-clear').css('display','block');
                            }else{
                                $('.input-clear').css('display','none');
                            }
                        }); 
                        // var sMarker = {
                        //     icon: new AMap.Icon({
                        //         size: new AMap.Size(19, 31),//图标大小
                        //         image: "http://webapi.amap.com/theme/v1.3/markers/n/start.png"
                        //     })
                        // };
                        // var eMarker = {
                        //     icon: new AMap.Icon({
                        //         size: new AMap.Size(19, 31),//图标大小
                        //         image: "http://webapi.amap.com/theme/v1.3/markers/n/end.png"
                        //     }),
                        //     offset: new AMap.Pixel(-9, -31)
                        // };
                        // var lOptions = {
                        //     strokeStyle: "solid",
                        //     strokeColor: "#FF33FF",
                        //     strokeOpacity: 1,
                        //     strokeWeight: 2,
                        // };
                        // var rulerOptions = {startMarkerOptions: sMarker, endMarkerOptions: eMarker, lineOptions: lOptions, midLabelText: '', endLabelText:'结束'};
                        // ruler = new AMap.RangingTool(theMap, rulerOptions);

                        AMap.event.addListener(mousetool, "draw", function callback(e) {
                            var eObject = e.obj;
                            eObject.on('rightclick',function(e){
                                eObject.hide();
                            })
                            if (eObject.CLASS_NAME=='AMap.Marker' && eObject.Hi.hasOwnProperty('content')) {
                                    layer.prompt({title: '文本内容', formType: 3}, function(v, index){
                                        layer.close(index);
                                        eObject.setContent('<span class="label label-danger">'+v+'</span>');
                                    });
                                    eObject.show();
                            }  
                        });
                    });
                }
            )
        }
        $('#point').click(function(){ 
            var mark= mousetool.marker({
                draggable:true,
                cursor:'move',
                animation:'AMAP_ANIMATION_DROP',
                // label:{content:'点',offset:new AMap.Pixel(0, -25)},
                clickable:true,
            });
            buttonStatus($(this),'绘制点');
            // if (buttonStatus($(this),'绘制点')) {
            //     layer.prompt({title: '绘制点名称', formType: 3}, function(v, index){
            //         layer.close(index);
            //         test=v;
            //     });
            // };
        });
        $('#line').click(function(){
            mousetool.polyline();

            // ruler.turnOn();

            buttonStatus($(this),'绘制线');
        });
        $('#polygon').click(function(){
            mousetool.polygon();

            buttonStatus($(this),'绘制面');
        });
        $('#drawtext').click(function(){
            var mark= mousetool.marker({
                draggable:true,
                cursor:'move',
                content:'<span class="label label-danger"></span>',
                clickable:true,
            });
            buttonStatus($(this),'绘制文本');
        });
        $('#circle').click(function(){
            mousetool.circle({
                 strokeColor: "#F33",
            });
            buttonStatus($(this),'绘制园');
        });
        function buttonStatus(e,v){
            if (e.text() == v) {
                clearCancel();
                e.text('取消绘制');
                e.attr("class","draw btn btn-success");
                return true;
            }else{
                e.text(v);
                e.attr("class","draw btn btn-primary");
                // ruler.turnOff();
                mousetool.close();
                return false;
            }
        }
        function clearCancel(){
            $('.draw').each(function(){
                    $(this).text($(this).val());
                    $(this).attr("class","draw btn btn-primary");
            })
        }
//        t
        var terminalTimer;

        var theMapMk = new Object();

        function clearTimer(){
            if(terminalTimer){
                window.clearInterval(terminalTimer);
            }
            terminalTimer = null;
        }

        function checkTerminalTimer(){

            var icon = new AMap.Icon({
                image:'__STATIC__/images/map_terminal.png',
                imageSize:new AMap.Size(42,48),
                size:new AMap.Size(42,48)
            });
            if(theMapMk.terminal && theMapMk.terminal.length > 0){
                if(terminalTimer)
                    return;
                terminalTimer = window.setInterval(function(){
                    var ids = $.map(theMapMk.terminal, function(item, index){
                        var extData = item.getExtData();
                        var user_id = extData.user_id;
                        return user_id;
                    });
                    theMap.remove(theMapMk.terminal);
                    theMapMk.terminal = new Array();
                    if(ids && ids.length>0){
                        $.get(
                                "{:U('mapReport')}",
                                {ids:ids},
                                function (data) {
                                    if(data.status == 1){
                                        var records = data.data.records;
                                        $('#dot-lists .dot-list:first .toggle-on .badge').remove();
                                        $('#dot-lists .dot-list:first .toggle-on').append('<span style="margin-left:5px;" class="badge">'+records.length+'</span>');
                                        for(var i in records){
                                            if(records[i].longitude && records[i].latitude){
                                                var m = new AMap.Marker({
                                                    icon:icon,
                                                    position:[records[i].longitude, records[i].latitude],
                                                    map:theMap
                                                });
                                                m.setExtData(records[i]);
                                                theMapMk.terminal.push(m);

                                                AMap.event.addListener(m,'click', function (v) {
                                                        initTerminalModal(v['target']['Hi']['extData']);

                                                        $terminalModal.modal('show');
                                                });
                                            }
                                        }
                                    }else{
                                        layer.msg(data.msg);
                                        $('#dot-lists .dot-list:first .toggle-on .badge').remove();
                                        clearTimer();
                                    }
                                }
                        )
                    }else{
                        clearTimer();
                    }
                },internal);
            }else{
                clearTimer();
            }
        }

        function initTerminalModal(data){
            clearImageView();
            for(var p in data){
                if(typeof(data[p]) != "function"){
                    $terminalModal.find('#' + p).val(data[p]) ;
                }
            }
            if(data.icon){
                viewImageTointro(data.icon);
            }
        }

        function initDatumModal(data, fields,class_id){
            if (data.name != null) {$('#title_name').text(data.name);}
            $datumTable.empty();
            for(var p in fields){
                var field = fields[p].field;
                var title = fields[p].title;
                if(data[field]!=undefined){
                    var html = '<tr><td>'+ title+  '</td><td>'+ data[field]+ '</td></tr>'
                    $datumTable.append(html);
                }
            }
            $.get(
                "{:U('queryDatumEnclosure')}",
                {
                    datum_dic_class:class_id,
                    datum_id:data.datum_id
                },
                function(data){
                    if(data.status == 1){
                        $('.enclosureDiv').show();
                        $('#enclosures').empty();
                        var enclosures = data.data;
                        for(var i in enclosures){
                            var html = '<li>'+ enclosures[i].enclosure_name +'</li>'
                            $('#enclosures').append(html);
                        }
                    }else{
                        $('.enclosureDiv').hide();
//                        layer.msg(data.msg);
                    }
                }

            )
        }

        function clearImageView () {
            $("#icon").val("");
            $("#icon_div").find(".image_show").html("");

        }

        function viewImageTointro(image) {
            if (image) {
                var root = "{:C('USER_ICON_URL')}";
                var imagesrc = root  + image;
                $("#icon_div").find(".image_show").show();
                $("#icon").val(image);
                $("#icon_div").find(".image_show").html("<img id='icon_preview' src='" + imagesrc + "' class='img-responsive' >");
            }
        }

        function getRectangleCenter(rectangle){
            if(rectangle){
                rectangle = rectangle.split(';');
                if(rectangle.length == 2){
                    var point1 = rectangle[0].split(',');
                    var point2 = rectangle[1].split(',');

                    var centerX = (parseFloat(point1[0])+parseFloat(point2[0]))/2;
                    var centerY = (parseFloat(point1[1])+parseFloat(point2[1]))/2;
                    return [centerX, centerY]
                }
            }
            return [116.397428, 39.90923];
        }



        $(function () {
            initMap();

            var mapGetHeight = function () {
                return $('#right').height() - $('#tool-bar').outerHeight();
            };
            var mapGetWidth = function () {
                return $('#right').width() - $('#dot-lists').outerWidth();
            };

            $('#map').css({height: mapGetHeight(), width: mapGetWidth()});
            $(window).resize(function () {
                $('#map').css({height: mapGetHeight(), width: mapGetWidth()});
            });

            $('#add').click(function () {
                $complexModal.modal('show');
            });

            $('#clear').click(function () {
                $('.toggleButton').bootstrapToggle('off');
                mousetool.close(true);
                clearCancel();
            });




//            var reportMk = new Array();
            var basePath = "__STATIC__/images/";
            $('.toggleButton').each(function () {
                var $toggleButton = $(this);
                var _class =  $toggleButton.attr('data-class');
                var _title = $toggleButton.attr('data-original-title');
                var url = $toggleButton.attr('data-url');
                var class_id = $toggleButton.attr('data-class-id');
                theMapMk[_class] = new Array();

                var icon = new AMap.Icon({
                    image:'__STATIC__/images/map_'+_class+'.png',
                    imageSize:new AMap.Size(42,48),
                    size:new AMap.Size(42,48),
                });

                $toggleButton.bootstrapToggle({
                    on:'<img style="height: 100%;" src="'+ basePath + _class +'_check.png">' + _title,
                    off:'<img style="height: 100%;" src="'+ basePath + _class +'.png">'+ _title,
                    width:182,
                    height:80
                });

                $toggleButton.change(function () {
                    if($(this).prop('checked')){
                        $.get(
                            url,
                            {class:_class},
                            function (data) {
                                if(data.status == 1){
                                    var records = data.data.records;
                                    for(var i in records){
                                        if(records[i].longitude && records[i].latitude){
                                            var m = new AMap.Marker({
                                                icon:icon,
                                                position:[records[i].longitude, records[i].latitude],
                                                map:theMap
                                            });
                                            m.setExtData(records[i]);
                                            theMapMk[_class].push(m);
                                            AMap.event.addListener(m,'click', function (v) {
                                                
                                                if(_class=='terminal'){
                                                    initTerminalModal(v['target']['Hi']['extData']);
                                                    $terminalModal.modal('show');
                                                }else{
                                                    var fields = data.data.fields;     
                                                    initDatumModal(v['target']['Hi']['extData'], fields,class_id);
                                                    $datumModal.modal('show');
                                                }
                                            });
                                        }
                                    }
                                    checkTerminalTimer();
                                }else{
                                    layer.msg(data.msg);
                                }
                            }
                        )
                    }else{
                        theMap.remove(theMapMk[_class]);
                        theMapMk[_class] = [];
                        checkTerminalTimer();
                    }

                });
            });

            $('.searchButton').click(function () {
                $('#clear').trigger('click');
                $.get(
                    "{:U('search')}",
                    {
                        search:$('#search').val(),
                        mapSelect:$('#mapSelect').val()
                    },
                    function (data) {
                        if(data.status == 1){
                            var records = data.data.records;
                            for(var i in records){
                                var _class = records[i].class;
                                var icon = new AMap.Icon({
                                    image:'__STATIC__/images/map_'+_class+'.png',
                                    imageSize:new AMap.Size(42,48),
                                    size:new AMap.Size(42,48),
                                });
                                var m = new AMap.Marker({
                                    icon:icon,
                                    position:[records[i].longitude, records[i].latitude],
                                    map:theMap
                                });
                                m.setExtData(records[i]);
                                theMapMk[_class].push(m);
                                AMap.event.addListener(m,'click', function (v) {
                                    if(_class=='terminal'){
                                        initTerminalModal(v['target']['si']['extData']);
                                        $terminalModal.modal('show');
                                    }
                                });
                                checkTerminalTimer();
                            }
                        }else{
                            layer.msg(data.msg);
                        }
                    }
                )

            })
            
        });
    </script>


</block>